Replace child count with "has children"#4829
Merged
Merged
Conversation
1b41c83 to
3c9a966
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #4829 +/- ##
=======================================
Coverage 88.30% 88.30%
=======================================
Files 301 301
Lines 26968 26968
Branches 7290 7290
=======================================
Hits 23814 23814
Misses 2936 2936
Partials 218 218 ☔ View full report in Codecov by Sentry. |
julienw
approved these changes
Dec 4, 2023
| callNodeTotalSummary[prefixCallNode] += | ||
| callNodeTotalSummary[callNodeIndex]; | ||
| callNodeChildCount[prefixCallNode]++; | ||
| callNodeHasChildren[prefixCallNode]++; |
Contributor
There was a problem hiding this comment.
do we want = 1 here? (for consistency mostly, but also to avoid overflow)
Contributor
Author
There was a problem hiding this comment.
Oops, yes, that was the intent. Thanks for catching it!
|
|
||
| hasChildren(callNodeIndex: IndexIntoCallNodeTable): boolean { | ||
| return this.getChildren(callNodeIndex).length !== 0; | ||
| return this._callNodeHasChildren[callNodeIndex] !== 0; |
Contributor
There was a problem hiding this comment.
I guess we could have used the previous childCount too, but I'm not opposed to changing childCount to hasChildren
We no longer need the child count, because the call tree's getChildren() method now uses nextSibling to find the children, so it doesn't need the child count any more for ending the search early. And the new flame graph implementation has dropped the other use of the child count. Having just one byte per call node rather than four bytes might improve the performance of computeCallTreeCountsAndSummary slightly, because it needs to touch fewer bytes in memory.
This avoids calls to getChildren for nodes which are visible but not expanded. The tree view calls hasChildren in order to determine whether to show the disclosure arrow. Avoiding the call to getChildren means that we don't have to allocate the array and sort it. This is especially useful in the inverted tree, which has lots of non-expanded nodes at the root level.
3c9a966 to
64d6cc8
Compare
Merged
mstange
added a commit
to mstange/perf.html
that referenced
this pull request
Jan 20, 2024
I missed this in firefox-devtools#4829; the changes there made this field unnecessary.
mstange
added a commit
to mstange/perf.html
that referenced
this pull request
Jan 22, 2024
This seems to have been unused for a while now. Initially I thought I had missed this in firefox-devtools#4829, but it seems to have been unused even before then.
mstange
added a commit
to mstange/perf.html
that referenced
this pull request
Jan 23, 2024
This seems to have been unused for a while now. Initially I thought I had missed this in firefox-devtools#4829, but it seems to have been unused even before then.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Main | Deploy preview
Small simplification for the call tree timings, with a little bonus perf at the end.